﻿@using System.Text.RegularExpressions
@model Easy.CMS.Article.ViewModel.ArticleTypeWidgetViewModel
@{
    string currentUrl = Url.Content(Model.TargetPage);
    if (!currentUrl.Contains("ac="))
    {
        if (currentUrl.Contains("?"))
        {
            currentUrl += "&ac=0";
        }
        else
        {
            currentUrl += "?ac=0";
        }
    }
}
<div class="widget article-category">
    <div class="list-group">
        @if (Model.ArticleTypes != null)
        {
            foreach (var item in Model.ArticleTypes)
            {
                <a href="@Regex.Replace(currentUrl, @"ac=\d", "ac=" + item.ID)" class="list-group-item @(item.ID == Model.ArticleTypeID ? "active" : "")">@item.Title</a>
            }
        }
    </div>
</div>